package com.parking.status.sync.netty.client;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.string.StringDecoder;

import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.List;

/**
 * Created by guojun on 2015/9/18.
 */
public class ResponseUrlStringDecoder extends StringDecoder{

    public ResponseUrlStringDecoder() {
        super(Charset.forName("Utf-8"));
    }

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {

        String src = msg.toString(Charset.forName("Utf-8"));
        String dest = src;//URLDecoder.decode(temp, "ASCII");
        out.add(dest);

    }
}
